Deduplicate repo+sysroot syncfs logic
This is a followup to https://github.com/ostreedev/ostree/pull/3504/commits/
6e5a27a29d33d50a2a4380c406405435d919b6b4
which I believe is correct as is. However, we already have a file
descriptor open for the ostree repo, which *must* be on
the same filesystem as `/sysroot/ostree` (the deployment
code forces hardlinking today).
It's hence cleaner to reuse that extant fd instead of opening
a new one - we know we did writes to that fd.
But going farther here, there already is logic to use syncfs
for the repo when downloading objects (in a common case
we actually syncfs twice).
Since these are really the same operation, unify them:
- Add journaling to the repo one syncfs case
- Change the sysroot case to just call it
- Since we log consistently to the journal for all syncfs/fsfreeze
operations now, drop the SyncStats bits which was a way
to add info about that to a later journal message
Additionally, let's add an extra check when we're
opening the repo that it's on the same device just on general
principle.
Signed-off-by: Colin Walters <walters@verbum.org>